package com.ignou.mca.util;

import java.util.Random;

public class RandamNumberGeneration {
	public static Random rn=null;
	static
	{
	 rn = new Random();
	}
	public static int rand(int lo, int hi)
	{
		//System.out.println("HIiiiiiiiiiiiiiiiiii : " + lo + " : " + hi);
		int n = hi - lo + 1;
		//System.out.println("n valueeeeee"+n+"  rn .............."+rn);
		int i = rn.nextInt() % n;
		if (i < 0)
			i = -i;
		//System.out.println("Byeeeeeeeeeeeee : " + (lo + i));
		return lo + i;
	}

	public static String randomstring(int lo, int hi)
	{
		int n = rand(lo, hi);

		//System.out.println("N valueeeeeeeeee: "+n);
		byte b[] = new byte[n];
		for (int i = 0; i < n; i++)
			b[i] = (byte)rand('a', 'z');
		return new String(b);
	}
}
